package nl.grol.yakshop.web.servlet.json;

import java.util.logging.Logger;

class CustomerOrder {
    private static final Logger LOGGER = Logger.getLogger(CustomerOrder.class.getName());

    private String customer;
	private OrderDetails order;
	
	@SuppressWarnings("unused")
	private CustomerOrder() {
		// needed for gson
	}
	
	public CustomerOrder(String customer, OrderDetails order) {
		super();
		this.customer = customer;
		this.order = order;
	}

	public String getCustomer() {
		return customer;
	}

	public OrderDetails getOrder() {
		return order;
	}
	
	public boolean isValid() {
		boolean status = true;
		
		if( this.customer == null ) {
			LOGGER.warning("Missing customer");
			status = false;
		}
		if( this.order == null ) {
			LOGGER.warning("Missing order");
			status = false;
		} else {
			status = this.order.isValid();
		}
		
		return status;
	}

}
